package cn.it.controller;

import cn.it.constant.MessageConstant;
import cn.it.entity.Result;
import cn.it.pojo.Menu;
import cn.it.service.MenuService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Reference
    public MenuService menuService;

    @RequestMapping("/loadMenu")
    public Result findMenu(String username){

        try {
            List<Menu> menus = menuService.findMenuAll(username);
            return new Result(true,"查询动态菜单成功",menus);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"动态构建菜单失败");
        }

    }

}
